<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateUserTable extends Migration
{
    /** 用户基本信息表
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('user', function (Blueprint $table) {
            $table->id();
            $table->string('nickname', 50)->comment('昵称');
            $table->tinyInteger('sex')->default(0)->comment('性别(0-男,1-女)');
            $table->date('birthday')->nullable()->comment('生日');
            $table->string('signature',255)->nullable()->comment('签名');
            $table->string('avatar', 200)->nullable()->comment('头像');
            $table->bigInteger('province_id')->nullable()->comment('省编号');
            $table->string('province',20)->nullable()->comment('省');
            $table->bigInteger('city_id')->nullable()->comment('市编号');
            $table->string('city',20)->nullable()->comment('市');
            $table->bigInteger('county_id')->nullable()->comment('县编号');
            $table->string('county',20)->nullable()->comment('县');
            $table->string('address',100)->nullable()->comment('详细地址');
            $table->string('im_user_code',100)->nullable()->comment('im编号');
            $table->string('qiniu_uid',50)->nullable()->comment('七牛用户ID');
            $table->string('qiniu_nickname',100)->nullable()->comment('七牛昵称');
            $table->string('phone', 50)->comment('手机号')->unique();
            $table->string('password', 200)->comment('密码');
            $table->string('true_name', 200)->nullable()->comment('真实姓名');
            $table->string('wechat_account', 200)->nullable()->comment('微信账号');
            $table->string('wechat_openid', 200)->nullable()->comment('微信openid');
            $table->string('street', 200)->nullable()->comment('街道乡镇');
            $table->unsignedInteger('street_id')->nullable()->comment('街道乡镇id');
            $table->string('address_detail_info',500)->nullable()->comment('具体地址信息');
            $table->string('alipay_account', 200)->nullable()->comment('支付宝账号');
            $table->string('pay_password', 200)->nullable()->comment('支付密码');
            $table->tinyInteger('is_auth')->default(0)->comment('实名状态0=否 1=是');
            $table->tinyInteger('is_face_auth')->default(0)->comment('是否人脸识别0=否 1=是');
            $table->tinyInteger('status')->default(0)->comment('状态0=正常1=禁用');
            $table->tinyInteger('is_vip')->default(0)->comment('是否vip:0-否；1-是；2-已过期；');
            $table->timestamp('vip_time')->nullable()->comment('vip_time-到期时间');
            $table->decimal('lat_point',10,6)->nullable()->comment('纬度');
            $table->decimal('lng_point',10,6)->nullable()->comment('精度');
            $table->tinyInteger('is_show')->default(1)->comment('是否显示');
            $table->string('del_phone',20)->nullable()->comment('被删除手机号');
            $table->timestamp('del_time')->nullable()->comment('删除时间');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('user');
    }
}
